commonlibsse_ng\re\n/
NiTStringMap.rs1use crate::re::NiTMap::NiTMap;
7use core::{ffi::c_char, fmt};
8
9#[repr(C)]
15#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
16pub struct NiTStringTemplateMap<Parent, V> {
17 pub __base: Parent,
19
20 pub copy: bool,
22
23 pub pad21: u8,
25 pub pad22: u16,
26 pub pad24: u32,
27
28 marker: core::marker::PhantomData<V>,
29}
30
31const _: () = {
32 type ParentType = [u8; 0x20];
33 assert!(core::mem::offset_of!(NiTStringTemplateMap::<ParentType, ()>, __base) == 0x00);
34 assert!(core::mem::offset_of!(NiTStringTemplateMap::<ParentType, ()>, copy) == 0x20);
35 assert!(core::mem::offset_of!(NiTStringTemplateMap::<ParentType, ()>, pad21) == 0x21);
36 assert!(core::mem::offset_of!(NiTStringTemplateMap::<ParentType, ()>, pad22) == 0x22);
37 assert!(core::mem::offset_of!(NiTStringTemplateMap::<ParentType, ()>, pad24) == 0x24);
38 assert!(core::mem::size_of::<NiTStringTemplateMap::<ParentType, ()>>() == 0x28);
39};
40
41#[repr(C)]
45#[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
46pub struct NiTStringMap<V> {
47 pub __base: NiTStringTemplateMap<NiTMap<*const c_char, V>, V>,
48}
49const _: () = {
50 assert!(core::mem::offset_of!(NiTStringMap::<()>, __base) == 0x00);
51 assert!(core::mem::size_of::<NiTStringMap::<()>>() == 0x28);
52};
53
54impl<V: fmt::Debug> fmt::Debug for NiTStringMap<V> {
55 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
56 let mut map = f.debug_map();
57 for (key, value) in self.__base.__base.iter() {
58 let key_str = unsafe {
59 if key.is_null() {
60 "<null>"
61 } else {
62 core::ffi::CStr::from_ptr(*key).to_str().unwrap_or("<invalid utf8>")
63 }
64 };
65 map.entry(&key_str, value);
66 }
67 map.finish()
68 }
69}